﻿<phone:PhoneApplicationPage 
    x:Class="AccountHelper.View.SettingView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:cmd="clr-namespace:MvvmLight.Command;assembly=MvvmLight"
    xmlns:accounthelper="clr-namespace:AccountHelper"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="728"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    DataContext="{Binding SettingVM, Source={StaticResource Locator}}" 
    shell:SystemTray.IsVisible="False" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit">


    <!--LayoutRoot contains the root grid where all other page content is placed-->
    <Grid x:Name="LayoutRoot">
        <controls:Pivot SelectedIndex="{Binding SettingsSelectIndex,Mode=TwoWay}">
            <!--Piovt item one-->
            <controls:PivotItem Header="基本">
                <ScrollViewer>
                    <Grid>
                        <StackPanel>
                            <Grid Margin="12,0,12,0">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="0.33*" />
                                    <ColumnDefinition Width="0.67*" />
                                </Grid.ColumnDefinitions>
                                <Image Grid.Column="0" Source="{Binding MainVM.ProfileImage,Source={StaticResource Locator}}" Height="140" Width="140" HorizontalAlignment="Left" Grid.ColumnSpan="2">
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="MouseLeftButtonDown">
                                            <cmd:EventToCommand Command="{Binding ChooseProfileImageCommand}" />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                </Image>
                                <StackPanel Grid.Column="1" >
                                    <TextBlock Text="我的帐户名称" FontSize="28" Margin="12,0,0,0" />
                                    <toolkit:PhoneTextBox Hint="请输入账号名称" Height="70" Text="{Binding UserName,Mode=TwoWay}" Grid.ColumnSpan="2" Margin="0">
                                        <i:Interaction.Behaviors>
                                            <accounthelper:UpdateSourceOnTextChangedBehavior />
                                        </i:Interaction.Behaviors>
                                    </toolkit:PhoneTextBox>
                                </StackPanel>
                            </Grid>

                            <toolkit:ToggleSwitch Header="广告" Height="111" HorizontalAlignment="Stretch"  Name="tsAd" VerticalAlignment="Top" Checked="tsAd_Checked" Unchecked="tsAd_Unchecked" />
                            <Button Content="Test" Click="Button_Click" />
                        </StackPanel>
                    </Grid>
                </ScrollViewer>
                
            </controls:PivotItem>
            <!--Piovt item two-->
            <controls:PivotItem Header="关于">
                <Grid>
                    <TextBlock Text="The Software belongs to...." Width="331" Height="60" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="26.667" Margin="8,0,0,0" FontFamily="Old English Text MT" />
                    <Image HorizontalAlignment="Right" Height="126" Margin="0,8,8,0" Source="/Images/a97911.jpg" Stretch="Fill" VerticalAlignment="Top" Width="140"/>
                    <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="About the Author" VerticalAlignment="Top" Margin="20,66,0,0"/>
                </Grid>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>
    
    <!--Appbar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar>
            <shell:ApplicationBarIconButton Text="新增费用" IconUri="/Images/Appbar/appbar.add.rest.png" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>